<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Dinic: Fichero Fuente apifiles/_stack.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Dinic
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">Documentacion de la API de DINIC para la cátedra de Matemática Discreta II.</div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Buscar" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generado por Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Buscar');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('__stack_8c_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Todo</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Estructuras de Datos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Archivos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Funciones</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>&apos;typedefs&apos;</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>&apos;defines&apos;</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">_stack.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="__stack_8c.html">Ir a la documentación de este archivo.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#include &lt;assert.h&gt;</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#include &lt;stdlib.h&gt;</span> </div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="__stack_8h.html">_stack.h</a>&quot;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;stdio.h&gt;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;</div>
<div class="line"><a name="l00009"></a><span class="lineno"><a class="line" href="structSElem.html">    9</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span>SElemSt{</div>
<div class="line"><a name="l00010"></a><span class="lineno"><a class="line" href="structSElem.html#a0f0b31748cf47160d9bfb0759ec301a2">   10</a></span>&#160;    <span class="keywordtype">void</span> * <a class="code" href="structSElem.html#a0f0b31748cf47160d9bfb0759ec301a2">elem</a>;            </div>
<div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="structSElem.html#af9410c5e16fcf50675a49ca8b4f23992">   11</a></span>&#160;    <span class="keyword">struct </span>SElemSt *<a class="code" href="structSElem.html#af9410c5e16fcf50675a49ca8b4f23992">next</a>;   </div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;}<a class="code" href="structSElem.html">SElem</a>;</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="structStackSt.html">   21</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structStackSt.html">StackSt</a>{</div>
<div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="structStackSt.html#adb183abce6209038066eb35a28d9eba5">   22</a></span>&#160;    <a class="code" href="structSElem.html">SElem</a> *<a class="code" href="structStackSt.html#adb183abce6209038066eb35a28d9eba5">top</a>;   </div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="structStackSt.html#a22462e398d5641767f8207f6204970bd">   23</a></span>&#160;    <a class="code" href="structSElem.html">SElem</a> *<a class="code" href="structStackSt.html#a22462e398d5641767f8207f6204970bd">iter</a>;  </div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="structStackSt.html#a439227feff9d7f55384e8780cfc2eb82">   24</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structStackSt.html#a439227feff9d7f55384e8780cfc2eb82">size</a>;     </div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;};</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="__stack_8h.html#adbe0fc6f4fbbfd3266b7ebeadd413cd3">   31</a></span>&#160;<a class="code" href="structStack.html">Stack</a> <a class="code" href="__stack_8c.html#adbe0fc6f4fbbfd3266b7ebeadd413cd3">stack_create</a> (<span class="keywordtype">void</span>){</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <a class="code" href="structStack.html">Stack</a> S = NULL;     <span class="comment">/*La nueva pilas*/</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    </div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    S = (<a class="code" href="structStack.html">Stack</a>) malloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structStackSt.html">StackSt</a>));</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="keywordflow">if</span> (S != NULL){</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;        S-&gt;top = NULL;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;        S-&gt;iter = NULL;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;        S-&gt;size = 0;</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    }</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <span class="keywordflow">return</span> S;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;}</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="__stack_8h.html#ac21780acf29f6bc27fd404a61b0b2fd8">   56</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="__stack_8c.html#ac21780acf29f6bc27fd404a61b0b2fd8">stack_destroy</a>(<a class="code" href="structStack.html">Stack</a> S, <span class="keywordtype">void</span> ** garbage){</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="keywordtype">int</span> result = -1;    <span class="comment">/*Retorno de la operación*/</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="keywordtype">int</span> i = 0;          <span class="comment">/*Contador de elementos que despiló*/</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <span class="keywordtype">int</span> sSize;          <span class="comment">/*Tamaño de la pila*/</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keywordtype">void</span> *elem;         <span class="comment">/*El elemento que se despila*/</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    </div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    assert(S != NULL);</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    sSize = <a class="code" href="__stack_8c.html#a663136e888acd5a17e0c190da92b0069">stack_size</a>(S);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <span class="comment">/*Hasta vaciar la pila, despilo los elementos*/</span></div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="keywordflow">while</span>(!<a class="code" href="__stack_8c.html#aceecd8ac8ccae30bcca91b877843e434">stack_isEmpty</a>(S)){</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;        <span class="comment">/*Si quiere referencia a los elementos, se los dejo en garbage*/</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        elem = <a class="code" href="__stack_8c.html#a72101773b7770f4aef2041f5b0d5e959">stack_pop</a>(S);</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        <span class="keywordflow">if</span>(garbage != NULL){</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;            garbage[i] = elem;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        }</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;        i++;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    }</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="comment">/*Si despilé todos los elementos, ya puedo destruir la pila*/</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="keywordflow">if</span>(sSize == i){</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        result = i;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        free(S);</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;        S = NULL;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    }</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;}</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="__stack_8h.html#ab0aed143ba08a11614cf428f26330750">   90</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="__stack_8c.html#ab0aed143ba08a11614cf428f26330750">stack_push</a>(<a class="code" href="structStack.html">Stack</a> S, <span class="keywordtype">void</span> *elem){</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <a class="code" href="structSElem.html">SElem</a> *<span class="keyword">new</span> = NULL;  <span class="comment">/*El nuevo elemento a apilar*/</span></div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keywordtype">int</span> result = 0;     <span class="comment">/*1 = esta todo OK*/</span></div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    </div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    <span class="keyword">new</span> = (<a class="code" href="structSElem.html">SElem</a> *) malloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> SElemSt));</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    <span class="keywordflow">if</span>(<span class="keyword">new</span> != NULL){</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        <span class="keyword">new</span>-&gt;<a class="code" href="structSElem.html#a0f0b31748cf47160d9bfb0759ec301a2">elem</a> = elem;</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        <span class="keyword">new</span>-&gt;next = S-&gt;top;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        S-&gt;top = <span class="keyword">new</span>;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        S-&gt;size ++;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        result = 1;</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    }</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;}</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="line" href="__stack_8h.html#a72101773b7770f4aef2041f5b0d5e959">  110</a></span>&#160;<span class="keywordtype">void</span> *<a class="code" href="__stack_8c.html#a72101773b7770f4aef2041f5b0d5e959">stack_pop</a>(<a class="code" href="structStack.html">Stack</a> S){</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <a class="code" href="structSElem.html">SElem</a> *aux = NULL;  <span class="comment">/*Puntero auxiliar para no perder referencias*/</span></div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordtype">void</span> *elem = NULL;  <span class="comment">/*El elemento de la estructura apilada*/</span></div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    </div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    assert(S != NULL &amp;&amp; !<a class="code" href="__stack_8c.html#aceecd8ac8ccae30bcca91b877843e434">stack_isEmpty</a>(S));</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    </div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    aux = S-&gt;top;</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    <span class="keywordflow">if</span> (aux-&gt;<a class="code" href="structSElem.html#af9410c5e16fcf50675a49ca8b4f23992">next</a> != NULL)</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;        S-&gt;top = S-&gt;top-&gt;next;</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        S-&gt;top = NULL;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    elem = aux-&gt;<a class="code" href="structSElem.html#a0f0b31748cf47160d9bfb0759ec301a2">elem</a>;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    free(aux);</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    S-&gt;size --;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <span class="keywordflow">return</span> elem;</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;}</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="__stack_8h.html#aceecd8ac8ccae30bcca91b877843e434">  133</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="__stack_8c.html#aceecd8ac8ccae30bcca91b877843e434">stack_isEmpty</a>(<a class="code" href="structStack.html">Stack</a> S){</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    assert(S != NULL);</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    <span class="keywordflow">return</span> (S-&gt;size == 0);</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;}</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;</div>
<div class="line"><a name="l00143"></a><span class="lineno"><a class="line" href="__stack_8h.html#ac271ba7c9291dd690642ee6a28faf2de">  143</a></span>&#160;<span class="keywordtype">void</span> *<a class="code" href="__stack_8c.html#ac271ba7c9291dd690642ee6a28faf2de">stack_top</a>(<a class="code" href="structStack.html">Stack</a> S){</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    <span class="keywordtype">void</span> * result = NULL;   <span class="comment">/*El elemento top que retorno*/</span></div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    assert(S != NULL);</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="keywordflow">if</span> (S-&gt;top != NULL)</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;        result = S-&gt;top-&gt;elem;</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;}</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="line" href="__stack_8h.html#a663136e888acd5a17e0c190da92b0069">  156</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="__stack_8c.html#a663136e888acd5a17e0c190da92b0069">stack_size</a>(<a class="code" href="structStack.html">Stack</a> S){</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    assert(S != NULL);</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;    <span class="keywordflow">return</span> (S-&gt;size);</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;}</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;</div>
<div class="line"><a name="l00169"></a><span class="lineno"><a class="line" href="__stack_8h.html#a0e2d0ba26caffc107704bf6251179226">  169</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="__stack_8c.html#a0e2d0ba26caffc107704bf6251179226">stack_revert</a>(<a class="code" href="structStack.html">Stack</a> S1, <a class="code" href="structStack.html">Stack</a> S2 ){</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    <a class="code" href="structSElem.html">SElem</a> *aux = NULL;    <span class="comment">/*Puntero auxiliar para no perder referencias*/</span></div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    <span class="keywordtype">int</span> result = 0;       <span class="comment">/*Resultado del revertido*/</span></div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    </div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    assert((S1 != NULL) &amp;&amp; (S2 != NULL));</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    assert(<a class="code" href="__stack_8c.html#aceecd8ac8ccae30bcca91b877843e434">stack_isEmpty</a>(S2));</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    aux = <a class="code" href="__stack_8c.html#ac271ba7c9291dd690642ee6a28faf2de">stack_top</a>(S1);</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    <span class="keywordflow">do</span>{ <span class="comment">/*copio los elementos de una pila a otra hasta el final de S1*/</span></div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;        result = <a class="code" href="__stack_8c.html#ab0aed143ba08a11614cf428f26330750">stack_push</a>(S2, aux);</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;        aux = aux-&gt;<a class="code" href="structSElem.html#af9410c5e16fcf50675a49ca8b4f23992">next</a>;</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    }<span class="keywordflow">while</span>((<a class="code" href="__stack_8c.html#a663136e888acd5a17e0c190da92b0069">stack_size</a>(S1) != <a class="code" href="__stack_8c.html#a663136e888acd5a17e0c190da92b0069">stack_size</a>(S2)) &amp;&amp; (result != 0));</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    </div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;}</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div>
<div class="line"><a name="l00191"></a><span class="lineno"><a class="line" href="__stack_8h.html#a2acf52ad79797bb647e535f848d42a63">  191</a></span>&#160;<span class="keywordtype">void</span> * <a class="code" href="__stack_8c.html#a2acf52ad79797bb647e535f848d42a63">stack_nextItem</a>(<a class="code" href="structStack.html">Stack</a> S){</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="keywordtype">void</span> * elem = NULL;     <span class="comment">/*El elemento a mostrar por el visor*/</span></div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    assert(S!=NULL);</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    </div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    <span class="keywordflow">if</span>(S-&gt;iter != NULL){</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;        elem = S-&gt;iter-&gt;elem;</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;        S-&gt;iter = S-&gt;iter-&gt;next;</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    }</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="keywordflow">return</span> elem;</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;}</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;</div>
<div class="line"><a name="l00206"></a><span class="lineno"><a class="line" href="__stack_8h.html#ad64d6f1087fc7f761084a3248160f2a1">  206</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="__stack_8c.html#ad64d6f1087fc7f761084a3248160f2a1">stack_resetViewer</a>(<a class="code" href="structStack.html">Stack</a> S){</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    assert(S!=NULL);</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    S-&gt;iter = S-&gt;top;</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;}</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;</div>
<div class="ttc" id="__stack_8c_html_ac271ba7c9291dd690642ee6a28faf2de"><div class="ttname"><a href="__stack_8c.html#ac271ba7c9291dd690642ee6a28faf2de">stack_top</a></div><div class="ttdeci">void * stack_top(Stack S)</div><div class="ttdoc">Muestra el elemento superior de la pila. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00143">_stack.c:143</a></div></div>
<div class="ttc" id="__stack_8h_html"><div class="ttname"><a href="__stack_8h.html">_stack.h</a></div><div class="ttdoc">La librería _stack proporciona una serie de herramientas para almacenar cualquier tipo de elemento en...</div></div>
<div class="ttc" id="__stack_8c_html_adbe0fc6f4fbbfd3266b7ebeadd413cd3"><div class="ttname"><a href="__stack_8c.html#adbe0fc6f4fbbfd3266b7ebeadd413cd3">stack_create</a></div><div class="ttdeci">Stack stack_create(void)</div><div class="ttdoc">Crea una pila vacía. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00031">_stack.c:31</a></div></div>
<div class="ttc" id="__stack_8c_html_ab0aed143ba08a11614cf428f26330750"><div class="ttname"><a href="__stack_8c.html#ab0aed143ba08a11614cf428f26330750">stack_push</a></div><div class="ttdeci">int stack_push(Stack S, void *elem)</div><div class="ttdoc">Agrega un elemento del tipo Alpha a la parte superior de la pila. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00090">_stack.c:90</a></div></div>
<div class="ttc" id="__stack_8c_html_aceecd8ac8ccae30bcca91b877843e434"><div class="ttname"><a href="__stack_8c.html#aceecd8ac8ccae30bcca91b877843e434">stack_isEmpty</a></div><div class="ttdeci">int stack_isEmpty(Stack S)</div><div class="ttdoc">Verifica que la pila este vacía. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00133">_stack.c:133</a></div></div>
<div class="ttc" id="structStackSt_html_a22462e398d5641767f8207f6204970bd"><div class="ttname"><a href="structStackSt.html#a22462e398d5641767f8207f6204970bd">StackSt::iter</a></div><div class="ttdeci">SElem * iter</div><div class="ttdoc">Puntero al elemento de la iteración. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00023">_stack.c:23</a></div></div>
<div class="ttc" id="__stack_8c_html_a0e2d0ba26caffc107704bf6251179226"><div class="ttname"><a href="__stack_8c.html#a0e2d0ba26caffc107704bf6251179226">stack_revert</a></div><div class="ttdeci">int stack_revert(Stack S1, Stack S2)</div><div class="ttdoc">Devuelve en S2 la pila S1 revertida. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00169">_stack.c:169</a></div></div>
<div class="ttc" id="structSElem_html_af9410c5e16fcf50675a49ca8b4f23992"><div class="ttname"><a href="structSElem.html#af9410c5e16fcf50675a49ca8b4f23992">SElem::next</a></div><div class="ttdeci">struct SElemSt * next</div><div class="ttdoc">Puntero a la siguiente estructura. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00011">_stack.c:11</a></div></div>
<div class="ttc" id="structSElem_html_a0f0b31748cf47160d9bfb0759ec301a2"><div class="ttname"><a href="structSElem.html#a0f0b31748cf47160d9bfb0759ec301a2">SElem::elem</a></div><div class="ttdeci">void * elem</div><div class="ttdoc">Puntero al elemento de esta estructura. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00010">_stack.c:10</a></div></div>
<div class="ttc" id="structStackSt_html_a439227feff9d7f55384e8780cfc2eb82"><div class="ttname"><a href="structStackSt.html#a439227feff9d7f55384e8780cfc2eb82">StackSt::size</a></div><div class="ttdeci">int size</div><div class="ttdoc">Cantidad de elementos de la pila. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00024">_stack.c:24</a></div></div>
<div class="ttc" id="__stack_8c_html_a72101773b7770f4aef2041f5b0d5e959"><div class="ttname"><a href="__stack_8c.html#a72101773b7770f4aef2041f5b0d5e959">stack_pop</a></div><div class="ttdeci">void * stack_pop(Stack S)</div><div class="ttdoc">Quita el elemento superior de la pila. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00110">_stack.c:110</a></div></div>
<div class="ttc" id="__stack_8c_html_ad64d6f1087fc7f761084a3248160f2a1"><div class="ttname"><a href="__stack_8c.html#ad64d6f1087fc7f761084a3248160f2a1">stack_resetViewer</a></div><div class="ttdeci">void stack_resetViewer(Stack S)</div><div class="ttdoc">Sitúa el visor en la parte superior de la pila. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00206">_stack.c:206</a></div></div>
<div class="ttc" id="structStack_html"><div class="ttname"><a href="structStack.html">Stack</a></div><div class="ttdoc">Puntero a una pila. </div></div>
<div class="ttc" id="structSElem_html"><div class="ttname"><a href="structSElem.html">SElem</a></div><div class="ttdoc">Estructura que encapsula un elemento que se apila. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00009">_stack.c:9</a></div></div>
<div class="ttc" id="__stack_8c_html_a663136e888acd5a17e0c190da92b0069"><div class="ttname"><a href="__stack_8c.html#a663136e888acd5a17e0c190da92b0069">stack_size</a></div><div class="ttdeci">int stack_size(Stack S)</div><div class="ttdoc">Devuelve la cantidad de elementos de la pila. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00156">_stack.c:156</a></div></div>
<div class="ttc" id="structStackSt_html"><div class="ttname"><a href="structStackSt.html">StackSt</a></div><div class="ttdoc">Estructura principal de una pila. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00021">_stack.c:21</a></div></div>
<div class="ttc" id="structStackSt_html_adb183abce6209038066eb35a28d9eba5"><div class="ttname"><a href="structStackSt.html#adb183abce6209038066eb35a28d9eba5">StackSt::top</a></div><div class="ttdeci">SElem * top</div><div class="ttdoc">Puntero al elemento superior de la pila. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00022">_stack.c:22</a></div></div>
<div class="ttc" id="__stack_8c_html_a2acf52ad79797bb647e535f848d42a63"><div class="ttname"><a href="__stack_8c.html#a2acf52ad79797bb647e535f848d42a63">stack_nextItem</a></div><div class="ttdeci">void * stack_nextItem(Stack S)</div><div class="ttdoc">Muestra un elemento y corre el visor al siguiente, NULL si no existe. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00191">_stack.c:191</a></div></div>
<div class="ttc" id="__stack_8c_html_ac21780acf29f6bc27fd404a61b0b2fd8"><div class="ttname"><a href="__stack_8c.html#ac21780acf29f6bc27fd404a61b0b2fd8">stack_destroy</a></div><div class="ttdeci">int stack_destroy(Stack S, void **garbage)</div><div class="ttdoc">Destruye y libera la memoria de la pila S preservando los elementos. </div><div class="ttdef"><b>Definition:</b> <a href="__stack_8c_source.html#l00056">_stack.c:56</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_5116870a98769fcb7fa621a6c1aaaf2c.html">apifiles</a></li><li class="navelem"><a class="el" href="__stack_8c.html">_stack.c</a></li>
    <li class="footer">Generado el Martes, 30 de Septiembre de 2014 12:40:17 para Dinic por
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li>
  </ul>
</div>
</body>
</html>
